<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
    <title>中科华洋抽奖-后台管理</title>
    <%@include file="common/include.jsp" %>
    <style type="text/css">
    	.col-lg-8 {
    		    position: absolute;
    			left: 33%;
    			top:20%;
    			width: 35%;
    	}
    </style>
    
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-lg-8">
        	<h1 style="color:gay; font-family:"SimHei";">
						中科华洋抽奖系统
			</h1>
            <form id="form" role="form">
                <div class="form-group">
                    <label for="name">用户名：</label>
                    <input type="text" class="form-control" id="name" name="name" value="" placeholder="请输入用户名">
                </div>
                <div class="form-group">
                    <label for="age">密码：</label>
                    <input type="password" class="form-control" id="pwd" name="pwd" value="" placeholder="请输入密码">
                </div>
                <button type="button" onclick="submitOfLogin();" class="btn btn-default">登录</button>
            </form>
        </div>
    </div>
</div>
<script>
   function submitOfLogin(){
	var name = $("#name").val();
   	var pwd = $("#pwd").val();
   	var data = {"name":name,"pwd":pwd};
       $.ajax({
           type: 'POST',
           url: '${ctx}/sysUser/login',
           data:JSON.stringify(data),
           contentType: 'application/json',
           dataType: 'json',
           success: function (data) {
               if (200==data.status) {
               	window.location.href = '${ctx}/prize/listPrize';
               }else{
               	alert(data.msg);
               }
           },
           error: function () {
               alert("出错了,请重试!");
           }
       }); 
   }
</script>
</body>
</html>